﻿using Dapper;
using Gx.Common.Core;
using Gx.Model.Entity;
using Gx.Model.ViewModel;
using System.Collections.Generic;
using System.Linq;

namespace Gx.Dal.Manage
{
    public class LKCustomerLevelDal : BaseDal<LKCustomerLevel>
    {
        /// <summary>
        /// 客户等级名称是否存在
        /// </summary>
        /// <param name="levelName"></param>
        /// <returns></returns>
        public bool AnyCustomerLevelName(string levelName)
        {
            using (var conn = new DbContext())
            {
                var total= conn.Connection.QueryFirst<int>("SELECT COUNT(1) FROM LK_CustomerLevel WHERE IsDeleted=0 AND LevelName=@levelName", new { levelName });
                return total > 0;
            }
        }
    }
}
